package com.learn.dead_letter;

import com.learn.utils.RabbitMqUtils;
import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;

import java.util.HashMap;
import java.util.Map;

/**
 * @author DJJ_F
 * @version 1.0
 * @date 2025/08/23
 * @description ch06 死信
 * 负责创建交换机和队列，配置死信
 */
public class Consumer02 {
    public static final String DEAD_QUEUE = "dead_queue";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMqUtils.getChannel();

        channel.basicConsume(DEAD_QUEUE, true,
                (consumerTag, message) -> {
                    System.out.println("死信消息：" + new String(message.getBody()));
                },
                consumerTag -> {});
    }
}
